﻿@using DotNet.Edu.Service
@model ExcerciseQuestion
@{
    Layout = null;
    int index = ViewBag.index;
    int prveIndex = index - 1;
    int nextIndex = index + 1;
    List<ExcerciseQuestion> favoriteQuestions = ViewBag.favoriteQuestions;
}
@if (Model == null)
{
    <div class="bs-callout bs-callout-warning" style="margin-right: 15px;margin-left: 15px;">
        <h4>暂无收藏题</h4>
    </div>
}
else
{
    <div class="row" style="margin-top: 15px;margin-left: 15px; margin-right: 15px; border:1px solid #cac8c9; padding:20px;">
        <p class="exercise_title">@(index + 1)、@Model.Name</p>
        <div>
            <ul class="exercise_answer">
                @if (Model.A.IsNotEmpty())
                {
                    <li>
                        A、@Model.A
                    </li>
                }
                @if (Model.B.IsNotEmpty())
                {
                    <li>
                        B、@Model.B
                    </li>
                }
                @if (Model.C.IsNotEmpty())
                {
                    <li>
                        C、@Model.C
                    </li>
                }
                @if (Model.D.IsNotEmpty())
                {
                    <li>
                        D、@Model.D
                    </li>
                }
                @if (Model.E.IsNotEmpty())
                {
                    <li>
                        E、@Model.E
                    </li>
                }
            </ul>
        </div>
        <div class="row" style="margin-top: 15px;">
            <div class="col-md-6" style="padding-left: 0">
                <a class="btn btn-success exercise_btn" id="answer_no" style="width: 150px;">标准答案：@Model.Answer</a>
            </div>
            <div class="col-md-6 text-right">

            </div>
        </div>
    </div>

    <div class="row" style="margin-top: 15px; margin-left: 15px;">
        <div class="col-md-4" style="font-size: 12px; line-height: 34px; padding-left: 0">
            共：<span id="total">@favoriteQuestions.Count</span> 题
        </div>
        <div class="col-md-8 text-right" style="padding-right: 30px;">
            @if (favoriteQuestions.Count > 0)
            {
                <a class="btn btn-default clearQuestion"
                   data-url="@Url.Action("ClearQuestion", new {questionId = Model.Id})">
                    <span class="fa fa-times-circle"></span> 清空
                </a>

                <a class="btn btn-default deleteQuestion"
                   data-url="@Url.Action("DeleteQuestion", new {questionId = Model.Id})"
                   sty style="margin-left: 15px;">
                    <span class="fa fa-trash-o"></span> 删除
                </a>
                
                if (prveIndex > -1)
                {
                    <a class="btn btn-default navQuestion" data-url="@Url.Action("_Question", new {index = prveIndex})" style="margin-left: 15px;"><span class="fa fa-arrow-left"></span> 上一题</a>
                }

                if (nextIndex < favoriteQuestions.Count)
                {
                    <a class="btn btn-default navQuestion" data-url="@Url.Action("_Question", new {index = nextIndex})" style="margin-left: 15px;"><span class="fa fa-arrow-right"></span> 下一题</a>
                }
            }
        </div>
    </div>
}